//package com.hnfnu.service;
//
//import com.hnfnu.constant.DisburseContractConstants;
//import com.hnfnu.protocol.model.bo.DisburseRecordAddRecordInputBO;
//import com.hnfnu.protocol.model.bo.DisburseRecordGetRecordsByProjectIdInputBO;
//import com.hnfnu.protocol.model.bo.DisburseRecordRecordsInputBO;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//import org.fisco.bcos.sdk.v3.client.Client;
//import org.fisco.bcos.sdk.v3.transaction.manager.AssembleTransactionProcessor;
//import org.fisco.bcos.sdk.v3.transaction.manager.TransactionProcessorFactory;
//import org.fisco.bcos.sdk.v3.transaction.model.dto.CallResponse;
//import org.fisco.bcos.sdk.v3.transaction.model.dto.TransactionResponse;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.PostConstruct;
//import java.util.Arrays;
//
//@Service
//@NoArgsConstructor
//@Data
//public class DisburseRecordService {
//    @Value("${contract.disburseRecordAddress}")
//    private String address;
//
//    @Autowired
//    private Client client;
//
//    AssembleTransactionProcessor txProcessor;
//
//    @PostConstruct
//    public void init() throws Exception {
//        this.txProcessor = TransactionProcessorFactory.createAssembleTransactionProcessor(this.client, this.client.getCryptoSuite().getCryptoKeyPair());
//    }
//
//    public CallResponse lastBlockId() throws Exception {
//        return this.txProcessor.sendCall(this.client.getCryptoSuite().getCryptoKeyPair().getAddress(), this.address, DisburseContractConstants.DisburseRecordAbi, "lastBlockId", Arrays.asList());
//    }
//
//    public CallResponse getRecordsByProjectId(DisburseRecordGetRecordsByProjectIdInputBO input) throws
//            Exception {
//        return this.txProcessor.sendCall(this.client.getCryptoSuite().getCryptoKeyPair().getAddress(), this.address, DisburseContractConstants.DisburseRecordAbi, "getRecordsByProjectId", input.toArgs());
//    }
//
//    public TransactionResponse addRecord(DisburseRecordAddRecordInputBO input) throws Exception {
//        return this.txProcessor.sendTransactionAndGetResponse(this.address, DisburseContractConstants.DisburseRecordAbi, "addRecord", input.toArgs());
//    }
//
//    public CallResponse records(DisburseRecordRecordsInputBO input) throws Exception {
//        return this.txProcessor.sendCall(this.client.getCryptoSuite().getCryptoKeyPair().getAddress(), this.address, DisburseContractConstants.DisburseRecordAbi, "records", input.toArgs());
//    }
//}
